#include<stdio.h>
#include<SDL2/SDL.h>
 SDL_Window *window;
 SDL_Renderer *render;
int init(){
    int ret = 1;
    if(SDL_Init(SDL_INIT_VIDEO)<0){
        printf("sdl could not init!sdl error:%s\n", SDL_GetError());
        ret = 0;
    }else{
        if((window = SDL_CreateWindow("sdl",SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED,400,300,0) )==NULL){
            printf("could not create! error:%s\n",SDL_GetError());
            ret = 0;
        }else{
              if((render = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED)) == NULL){
            printf("render could not create! error:%s\n",SDL_GetError());
            ret = 0;
        }
        }
    }
    return ret;
}

int main(int argc, char *argv[]){
   if(!init()){
       printf("init error!\n");
   }else{
       SDL_SetRenderDrawColor(render, 111,111,111,255);
       
        SDL_RenderClear(render);     
        SDL_RenderPresent(render);
        SDL_Delay(4000);
        SDL_DestroyWindow(window);
        SDL_DestroyRenderer(render);
        SDL_Quit();
   }
    return 0;
}